/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.ex;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * <p>Project: javaseapp - Ex3
 * <p>Powered by webrx On 2021-08-04 09:01:10
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Ex3 {
    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            game();
        }
    }

    public static void game() {
        Random rand = new Random();
        //blue ball 1-16 (1)
        int blue = rand.nextInt(16) + 1;
        //red ball 1-33  (6)
        //System.out.println(blue);

        //Set集合工具类，内容没有顺序，但不能重复
        Set<Integer> red = new HashSet<Integer>();
        while (red.size() != 6) {
            red.add(rand.nextInt(33) + 1);
        }
        //System.out.println(red);
        System.out.print("红：");
        for (int i : red) {
            System.out.printf("%02d ", i);
        }
        System.out.printf("\t蓝：%02d%n", blue);
    }
}
